home *** CD-ROM | disk | FTP | other *** search
/ Aminet 30 / Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso / Aminet / util / pack / xpk_Source.lha / xpk_Source / test / testFilePack.c < prev    next >
C/C++ Source or Header  |  1998-11-09  |  1KB  |  63 lines

  1. #define NAME        "testFilePack"
  2. #define DISTRIBUTION    "(Freeware) "
  3. #define REVISION    "1"
  4. #define SDI_ENDCODE_NOCTRLC
  5.  
  6. /* Programmheader
  7.  
  8.     Name:        testFilePack
  9.     Author:        SDI
  10.     Distribution:    Freeware
  11.     Description:    easy file to file packer
  12.     Compileropts:    -
  13.     Linkeropts:    -l xpkmaster amiga
  14.  
  15.  1.0   06.01.97 : wrote to find the read bit error
  16.  1.1   28.11.97 : moved chunk-hook into include file
  17. */
  18.  
  19. #include <proto/exec.h>
  20. #include <proto/dos.h>
  21. #include <proto/xpkmaster.h>
  22. #include <exec/memory.h>
  23. #include "SDI_defines.h"
  24. #include "chunkhook.c"
  25.  
  26. struct Library        *XpkBase        = 0;
  27. ULONG            DosVersion        = 37;
  28. struct RDArgs        *rda            = 0;
  29.  
  30. #define PARAM "FROM/A,TO/A,METHOD"
  31.  
  32. void main(void)
  33. {
  34.   UBYTE errbuf[XPKERRMSGSIZE+1];
  35.   struct {
  36.     STRPTR from;
  37.     STRPTR to;
  38.     STRPTR method;
  39.   } args = {0,0,"USER"};
  40.  
  41.   if(!(rda = ReadArgs(PARAM, (LONG *) &args, 0)) ||
  42.   !(XpkBase = OpenLibrary(XPKNAME, 3)))
  43.     End(RETURN_FAIL);
  44.  
  45.   if(XpkPackTags(XPK_InName, args.from, XPK_OutName, args.to,
  46.   XPK_PackMethod, args.method, XPK_GetError,
  47.   errbuf, XPK_ChunkHook, &chunkhook, TAG_DONE))
  48.   {
  49.     STRPTR a = errbuf;
  50.     VPrintf("Can't XpkPack: %s\n", &a);
  51.     End(RETURN_FAIL);
  52.   }
  53.  
  54.   End(RETURN_OK);
  55. }
  56.  
  57. void end(void)
  58. {
  59.   if(XpkBase)    CloseLibrary(XpkBase);
  60.   if(rda)    FreeArgs(rda);
  61. }
  62.  
  63.